package com.qcby.community.mapper;

import com.qcby.community.entity.Menu;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * 菜单管理 Mapper 接口
 * </p>
 *
 * @author admin
 * @since 2024-03-25
 */
@Repository
public interface MenuMapper extends BaseMapper<Menu> {

    @Select("SELECT m.* FROM menu m,user_role ur,role_menu rm \n" +
            "WHERE m.menu_id=rm.menu_id AND ur.role_id=rm.role_id AND ur.user_id=#{userId} order by sort")
    List<Menu> getMenusByUserId(Integer userId);
}
